<template>
    <el-card shadow="never" style="border: 0;">
        <yun-form
                :data="row"
                ref="fastform"
                :columns="columns">
                <template #default>
                    {:token_field()}
                </template>
                <template #price="{rows}">
                    <el-form-item label="默认价格" prop="price">
                        <el-input v-model="rows.price" :min="0" :step="0.01">
                            <template #append>元/{{rows.unit}}</template>
                        </el-input>
                    </el-form-item>
                </template>
        </yun-form>
    </el-card>
</template>
<script>
    import form from "@components/Form.js";
    export default{
        components:{
            'YunForm':form
        },
        data:{
            columns:[
                {"field":"id","title":"ID",width:80,"edit":"hidden"},
                {"field":"name","title":"商品名称","edit":"text","rules":"required"},
                {"field":"des","title":"商品简介",width:300,"edit":"textarea"},
                {
                    "field":"spec",
                    "title":"商品规格",
                    "edit":Yunqi.config.route[2]=='add'?{form:'fieldlist',label:['名称','单价','单位'],keys:['name','price','unit'],value:[{name:'',price:'',unit:''}]}:'',
                    "rules":"required",
                },
                {"field":"icon","title":"首页图标",width:120,"edit":"image","rules":"required"},
                {"field":"img","title":"介绍图片",width:120,"edit":"images","rules":"required"},
                {"field":"status","title":"状态","edit":"switch","searchList":{"normal":"正常","hidden":"隐藏"}},
            ],
            row:Yunqi.data.row || {}
        },
        methods: {
          
        }
    }
</script>
<style>
    
</style>

